import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;

/**
 * Author: Daniel Michalski
 * Date: 06.02.13
 */

@Retention(RetentionPolicy.RUNTIME)
@interface  MyAnno {
    String str();
    int val();
}

public class Main {
    @MyAnno(str = "Przykładowa adnotacja" , val = 100)
    public static void myMeth(String str, int i) {
        Main ob = new Main();

        Class c = ob.getClass();

        try {
            Method m = c.getMethod("myMeth", String.class, int.class);
            MyAnno anno = m.getAnnotation(MyAnno.class);

            System.out.println(anno.str() + " " + anno.val());
        } catch (NoSuchMethodException e) {
            System.out.println("Nie znaleziono metody myMeth");
        }
    }



    public static void main(String[] args) {
        myMeth("test", 10);
    }
}
